﻿#region Header

/*
Remote views based on linq
By

Pascal Hauser 
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

and

Raphael Gfeller
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

*/

#endregion

#region Usings

using System;
using System.Collections.Generic;
using Sebarf.Services.Interfaces;
using Sebastof.Services.Interfaces;

#endregion

namespace Sebastof.Client.Services.Impl {
	/// <summary>
	/// Impl of <see cref="ISerializationDataHandlingStrategyService"/>
	/// Uses the <see cref="StandardDataHandlingStrategy"/>
	/// </summary>
	public class StandardSerializationDataHandlingStrategyService : Service, ISerializationDataHandlingStrategyService {
		#region ISerializationDataHandlingStrategyService Members

		public Dictionary<string, object> GetDataToTransferFromObject(object obj) {
			throw new NotImplementedException();
		}

		public void RestoreObjectFromTransferedData(object obj, Dictionary<string, object> data) {
			var iObject = obj as ISebastofApplicationObject;

			if (iObject is SebastofApplicationObject) {
				// register sdt data loading strategy
				(iObject as SebastofApplicationObject).UsedDataHandlingStrategy = new StandardDataHandlingStrategy(iObject);
			}

			foreach (var item in data) {
				iObject.SetValue(item.Key, item.Value);
			}
		}

		#endregion
	}
}